class RemoveColumnFromWeeklyResults < ActiveRecord::Migration
  def self.up
    Weekly.connection.execute %[ALTER TABLE "main"."weekly_results" RENAME TO "t_weekly_results"]
    Weekly.connection.execute %[CREATE TABLE "main"."weekly_results" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"weekly_id" integer,"clicks" integer,"clicks_rank" integer,"comments" integer,"comments_rank" integer,"danmu" integer,"danmu_rank" integer,"part" integer,"score" integer,"score_rank" integer,"stows" integer,"stows_rank" integer,"sp_type_id" integer,"tj" integer,"tj_rank" integer,"yb" integer,"yb_rank" integer,"weekly_result_work_id" integer)]
    Weekly.connection.execute %[INSERT INTO "main"."weekly_results" SELECT "id","weekly_id","clicks","clicks_rank","comments","comments_rank","danmu","danmu_rank","part","score","score_rank","stows","stows_rank","sp_type_id","tj","tj_rank","yb","yb_rank","weekly_result_work_id" FROM "main"."t_weekly_results"]
    Weekly.connection.execute %[DROP TABLE "main"."t_weekly_results"]
    Weekly.connection.execute "vacuum"
  end

  def self.down
  end
end
